|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
AbstractModule.java | 75% | 61.5% | 63.6% | 63.4% |
|
1 |
/*
|
|
2 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
|
|
17 |
package org.apache.geronimo.ews.ws4j2ee.module;
|
|
18 |
|
|
19 |
import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
|
|
20 |
|
|
21 |
import java.io.IOException;
|
|
22 |
import java.io.InputStream;
|
|
23 |
import java.util.jar.JarFile;
|
|
24 |
import java.util.zip.ZipEntry;
|
|
25 |
import java.util.zip.ZipFile;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* @author Srinath Perera(hemapani@opensource.lk)
|
|
29 |
*/
|
|
30 |
public abstract class AbstractModule implements Module { |
|
31 |
protected InputStream wscfFile;
|
|
32 |
protected InputStream webddfile;
|
|
33 |
protected InputStream ejbJarfile;
|
|
34 |
protected InputStream wsdlfile;
|
|
35 |
protected InputStream jaxrpcfile;
|
|
36 |
protected ZipFile zip;
|
|
37 |
protected ClassLoader parentCL;
|
|
38 |
|
|
39 | 10 |
public AbstractModule(String jarFile, ClassLoader parentCL) throws GenerationFault { |
40 | 10 |
try {
|
41 | 10 |
this.parentCL = parentCL;
|
42 | 10 |
zip = new JarFile(jarFile);
|
43 |
} catch (IOException e) {
|
|
44 | 0 |
e.printStackTrace(); |
45 | 0 |
throw GenerationFault.createGenerationFault(e);
|
46 |
} |
|
47 |
} |
|
48 |
|
|
49 | 8 |
public InputStream getInputStreamForJarEntry(String path)
|
50 |
throws GenerationFault {
|
|
51 | 8 |
try {
|
52 | 8 |
ZipEntry zentry = zip.getEntry(path); |
53 | 8 |
if (zentry != null) { |
54 | 0 |
return zip.getInputStream(zentry);
|
55 |
} else {
|
|
56 | 8 |
return null; |
57 |
} |
|
58 |
} catch (IOException e) {
|
|
59 | 0 |
e.printStackTrace(); |
60 | 0 |
throw GenerationFault.createGenerationFault(e);
|
61 |
} |
|
62 |
} |
|
63 |
|
|
64 | 27 |
public InputStream getInputStreamForJarEntry(String jarFile, String path)
|
65 |
throws GenerationFault {
|
|
66 | 27 |
try {
|
67 | 27 |
ZipEntry zentry = zip.getEntry(path); |
68 | 27 |
if (zentry != null) { |
69 | 20 |
return zip.getInputStream(zentry);
|
70 |
} else {
|
|
71 | 7 |
return null; |
72 |
} |
|
73 |
} catch (IOException e) {
|
|
74 | 0 |
e.printStackTrace(); |
75 | 0 |
throw GenerationFault.createGenerationFault(e);
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 | 0 |
public void loadtheClassesInJarFile() throws GenerationFault { |
80 |
} |
|
81 |
|
|
82 |
/**
|
|
83 |
* @return
|
|
84 |
*/
|
|
85 | 8 |
public InputStream getEjbJarfile() {
|
86 | 8 |
return ejbJarfile;
|
87 |
} |
|
88 |
|
|
89 |
/**
|
|
90 |
* @return
|
|
91 |
*/
|
|
92 | 8 |
public InputStream getWebddfile() {
|
93 | 8 |
return webddfile;
|
94 |
} |
|
95 |
|
|
96 |
/**
|
|
97 |
* @return
|
|
98 |
*/
|
|
99 | 8 |
public InputStream getWscfFile() {
|
100 | 8 |
return wscfFile;
|
101 |
} |
|
102 |
|
|
103 |
/**
|
|
104 |
* @param stream
|
|
105 |
*/
|
|
106 | 0 |
public void setEjbJarfile(InputStream stream) { |
107 | 0 |
ejbJarfile = stream; |
108 |
} |
|
109 |
|
|
110 |
/**
|
|
111 |
* @param stream
|
|
112 |
*/
|
|
113 | 0 |
public void setWebddfile(InputStream stream) { |
114 | 0 |
webddfile = stream; |
115 |
} |
|
116 |
|
|
117 |
/**
|
|
118 |
* @param stream
|
|
119 |
*/
|
|
120 | 0 |
public void setWscfFile(InputStream stream) { |
121 | 0 |
wscfFile = stream; |
122 |
} |
|
123 |
|
|
124 | 8 |
public InputStream findFileInModule(String path) throws GenerationFault { |
125 | 8 |
return getInputStreamForJarEntry(path);
|
126 |
} |
|
127 |
|
|
128 |
} |
|
129 |
|
|